package fashionshop.gui_old;

import java.awt.BorderLayout;
import java.util.Vector;

import javax.swing.JLabel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.SwingConstants;
import javax.swing.table.DefaultTableModel;

import fashionshop.bll.CustomerBLL;
import fashionshop.bll.OrderBLL;

public class OrderUI {

	private JTable orderTable;
	Vector orderTableTitle;
    Vector orderTableRecords;
	
	public OrderUI() throws Exception{
		orderTable = new JTable();
		orderTableTitle = new Vector();
		orderTableRecords = new Vector();
		orderTableTitle.add("ID");
		orderTableTitle.add("Tên nhân viên");
		orderTableTitle.add("Tên khách hàng");
		orderTableTitle.add("Tổng cộng");
		orderTableTitle.add("Chiết khấu");
		orderTableTitle.add("Ngày đặt");
		orderTableTitle.add("Ngày thanh toán");
		orderTableTitle.add("Ghi chú");
		orderTableTitle.add("Tình trạng");
		orderTableRecords = OrderBLL.loadAllOrder();
		orderTable.setModel(new DefaultTableModel(orderTableRecords, orderTableTitle));
		
	}
	
	public void loadAllOrder(){
		MainScreen.tablePanel.removeAll();
		MainScreen.tablePanel.setLayout(new BorderLayout());
		MainScreen.tablePanel.add(new JScrollPane(orderTable), BorderLayout.CENTER);
		MainScreen.tablePanel.revalidate();
	}
}
